import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)
import orders from '@/store/modules/Orders'
import search from '@/store/modules/search'
import carts from '@/store/modules/cart'
import user from '@/store/modules/user'
import addrs from '@/store/modules/addrList.js'
import createPersistedState from 'vuex-persistedstate'
const store = new Vuex.Store({
	modules:{
		namespace:true,
		orders,
		search,
		carts,
		user,
		addrs
	},
	plugins :[createPersistedState(
	{
		storage:{
			getItem: (key) => uni.getStorageInfoSync(key),
			setItem: (key,val) =>uni.setStorageSync(key,val),
			removeItem: (key) => uni.removeStorageSync(key),
		}
	}
	)]
})

export default store;
